#ifndef __FAST_IO_H__
#define __FAST_IO_H__

#include <ntifs.h>

BOOLEAN FastIOCheckIfPossible(IN PFILE_OBJECT pFileObject,
                              IN PLARGE_INTEGER pliFileOffset,
                              IN ULONG ulLength,
                              IN BOOLEAN bWait,
                              IN ULONG ulLockKey,
                              IN BOOLEAN bCheckForReadOperation,
                              OUT PIO_STATUS_BLOCK pIOStatus,
                              IN PDEVICE_OBJECT pDeviceObject);

BOOLEAN FastIORead(IN PFILE_OBJECT pFileObject,
                   IN PLARGE_INTEGER pliFileOffset,
                   IN ULONG ulLength,
                   IN BOOLEAN bWait,
                   IN ULONG ulLockKey,
                   OUT PVOID pBuffer,
                   IN OUT PIO_STATUS_BLOCK pIOStatus,
                   IN PDEVICE_OBJECT pDeviceObject);

BOOLEAN FastIOWrite(IN PFILE_OBJECT pFileObject,
                    IN PLARGE_INTEGER pliFileOffset,
                    IN ULONG ulLength,
                    IN BOOLEAN bWait,
                    IN ULONG ulLockKey,
                    IN PVOID pBuffer,
                    IN OUT PIO_STATUS_BLOCK pIOStatus,
                    IN PDEVICE_OBJECT pDeviceObject);

BOOLEAN FastIOQueryBasicInfo(IN PFILE_OBJECT pFileObject,
							 IN BOOLEAN bWait,
							 OUT PFILE_BASIC_INFORMATION pBuffer,
							 OUT PIO_STATUS_BLOCK pIOStatus,
							 IN PDEVICE_OBJECT pDeviceObject);

BOOLEAN FastIOQueryStandardInfo(IN PFILE_OBJECT pFileObject,
								IN BOOLEAN bWait,
								OUT PFILE_STANDARD_INFORMATION pBuffer,
								OUT PIO_STATUS_BLOCK pIOStatus,
								IN PDEVICE_OBJECT pDeviceObject);

BOOLEAN FastIOLock(IN PFILE_OBJECT pFileObject,
				   IN PLARGE_INTEGER pFileOffset,
				   IN PLARGE_INTEGER pLength,
				   IN PEPROCESS pProcessId,
				   IN ULONG uKey,
				   IN BOOLEAN bFailImmediately,
				   IN BOOLEAN bExclusiveLock,
				   OUT PIO_STATUS_BLOCK pIoStatus,
				   IN PDEVICE_OBJECT pDeviceObject);

BOOLEAN FastIOUnlockSingle(IN PFILE_OBJECT pFileObject,
						   IN PLARGE_INTEGER pFileOffset,
						   IN PLARGE_INTEGER pLength,
						   IN PEPROCESS pProcessId,
						   IN ULONG uKey,
						   OUT PIO_STATUS_BLOCK pIoStatus,
						   IN PDEVICE_OBJECT pDeviceObject);

BOOLEAN FastIOUnlockAll(IN PFILE_OBJECT pFileObject,
						IN PEPROCESS pProcessId,
						OUT PIO_STATUS_BLOCK pIoStatus,
						IN PDEVICE_OBJECT pDeviceObject);

BOOLEAN FastIOUnlockAllByKey(IN PFILE_OBJECT pFileObject,
							 IN PVOID pProcessId,
							 IN ULONG uKey,
							 OUT PIO_STATUS_BLOCK pIoStatus,
							 IN PDEVICE_OBJECT pDeviceObject);

BOOLEAN FastIODeviceControl(IN PFILE_OBJECT pFileObject,
							IN BOOLEAN bWait,
							IN PVOID pInputBuffer,
							IN ULONG uInputBufferLength,
							OUT PVOID pOutputBuffer,
							IN ULONG uOutputBufferLength,
							IN ULONG uIoControlCode,
							OUT PIO_STATUS_BLOCK pIoStatus,
							IN PDEVICE_OBJECT pDeviceObject);

VOID FastIODetachDevice(IN PDEVICE_OBJECT pSourceDevice,
						IN PDEVICE_OBJECT pTargetDevice);

BOOLEAN FastIOQueryNetworkOpenInfo(IN PFILE_OBJECT pFileObject,
								   IN BOOLEAN bWait,
								   OUT PFILE_NETWORK_OPEN_INFORMATION pBuffer,
								   OUT PIO_STATUS_BLOCK pIoStatus,
								   IN PDEVICE_OBJECT pDeviceObject);

BOOLEAN MdlRead(IN PFILE_OBJECT pFileObject,
				IN PLARGE_INTEGER pFileOffset,
				IN ULONG ulLength,
				IN ULONG ulLockKey,
				OUT PMDL* pMdlChain,
				OUT PIO_STATUS_BLOCK pIoStatus,
				IN PDEVICE_OBJECT pDeviceObject);

BOOLEAN MdlReadComplete(IN PFILE_OBJECT pFileObject,
						IN PMDL pMdlChain,
						IN PDEVICE_OBJECT pDeviceObject);

BOOLEAN PrepareMdlWrite(IN PFILE_OBJECT pFileObject,
						IN PLARGE_INTEGER pFileOffset,
						IN ULONG ulLength,
						IN ULONG ulLockKey,
						OUT PMDL* pMdlChain,
						OUT PIO_STATUS_BLOCK pIoStatus,
						IN PDEVICE_OBJECT pDeviceObject);

BOOLEAN MdlWriteComplete(IN PFILE_OBJECT pFileObject,
						 IN PLARGE_INTEGER pFileOffset,
						 IN PMDL pMdlChain,
						 IN PDEVICE_OBJECT pDeviceObject);

BOOLEAN FastIoReadCompressed(IN PFILE_OBJECT pFileObject,
							 IN PLARGE_INTEGER pFileOffset,
							 IN ULONG ulLength,
							 IN ULONG ulLockKey,
							 OUT PVOID pBuffer,
							 OUT PMDL* pMdlChain,
							 OUT PIO_STATUS_BLOCK pIoStatus,
							 OUT PCOMPRESSED_DATA_INFO pCompressedDataInfo,
							 IN ULONG ulCompressedDataInfoLength,
							 IN PDEVICE_OBJECT pDeviceObject);

BOOLEAN FastIoWriteCompressed(IN PFILE_OBJECT pFileObject,
							  IN PLARGE_INTEGER pFileOffset,
							  IN ULONG ulLength,
							  IN ULONG ulLockKey,
							  IN PVOID pBuffer,
							  OUT PMDL* pMdlChain,
							  OUT PIO_STATUS_BLOCK pIoStatus,
							  IN PCOMPRESSED_DATA_INFO pCompressedDataInfo,
							  IN ULONG ulCompressedDataInfoLength,
							  IN PDEVICE_OBJECT pDeviceObject);

BOOLEAN MdlReadCompleteCompressed(IN PFILE_OBJECT pFileObject,
								  IN PMDL pMdlChain,
								  IN PDEVICE_OBJECT pDeviceObject);

BOOLEAN MdlWriteCompleteCompressed(IN PFILE_OBJECT pFileObject,
								   IN PLARGE_INTEGER pFileOffset,
								   IN PMDL pMdlChain,
								   IN PDEVICE_OBJECT pDeviceObject);

BOOLEAN FastIoQueryOpen(IN OUT PIRP pIrp,
						OUT PFILE_NETWORK_OPEN_INFORMATION pNetworkInformation,
						IN PDEVICE_OBJECT pDeviceObject);

#endif